import 'package:flutter/material.dart';
import 'post.dart';
 
class DataTablePost extends StatefulWidget {
  @override
  _DataTablePostState createState() => _DataTablePostState();
}
 
class _DataTablePostState extends State<DataTablePost> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('DataTableDemo'),
        elevation: 0.0,
      ),
      body: Container(
        padding: EdgeInsets.all(16.0),
        child: ListView(
          children: <Widget>[
            DataTable(columns: [
              DataColumn(label: Text("Title")),
              DataColumn(label: Text('Anthor')),
              DataColumn(label: Text('Image')),
            ], rows: posts.map(
              (post){
                return DataRow(
                  cells: [
                    DataCell(Text(post.title),onTap:(){print('a');}),
                    DataCell(Text(post.author)),
                    DataCell(Image.network(post.imgeUrl)),
                  ]
                );
              }
            ).toList()
            
            ),
          ],
        ),
      ),
    );
  }
}
